<?php
/*
	本插件：$this->model('model')->方法名();
	其他地方调用：model('jy_lianmerch/model')->方法名();
*/
namespace jy_lianmerch;
defined('BY_JYA') or exit('error');
class model extends \plugin{
	public function check_worker($mid='',$noexi=false){
		if(!$_SESSION['uid']){
			model('jy_weishop/member')->checklogin();
		}
		if($this->session('isworker')){
			return true;
		}
		$mid=$mid?:$_SESSION['uid'];
		$workers=$this->setting['workers'];
		foreach($workers as $wv){
			if($wv['mid']==$mid){
				$this->session('isworker',1);
			}
		}
		if(!$this->session('isworker')){
			if(!$noexi){
				exi('您不是员工，无权访问！','error','jy_lianmerch/error/');
			}
			return false;
		}
	}
}
?>